<template>
    <n-menu :value="activeKey" mode="horizontal" :options="menus" @update:value="handleUpdateMenu" />
</template>

<script setup lang="ts">
/* eslint-disable */
import { computed } from 'vue';
import router from '@/router';
import type { MenuOption } from 'naive-ui';
import { useRoute } from 'vue-router';
import { useRouteStore } from '@/store/route/route';
import type { GlobalMenuOption } from '@/types/global';

const routeStore = useRouteStore();
const route = useRoute()

const menus = computed(() => routeStore.menus as GlobalMenuOption[]);

const activeKey = computed(() => route.name as string)

function handleUpdateMenu(_key: string, item: MenuOption) {
    const menuItem = item as GlobalMenuOption;
    console.log(menuItem, "点击菜单的值");
    router.push(menuItem.routePath);
}
</script>
<style scoped>
</style>
